package com.ds.infra.mq.core.server;

import com.ds.infra.mq.core.config.BrokerConfig;
import com.ds.infra.mq.core.config.NettyConfig;
import com.ds.infra.mq.core.config.StorageConfig;
import lombok.extern.slf4j.Slf4j;

/**
 * 作用：启动MQ服务器的入口类
 *
 * @author WeiShaoying
 */
@Slf4j
public class MQServer {
    public static void main(String[] args) {
        BrokerConfig brokerConfig = new BrokerConfig();
        NettyConfig nettyConfig = new NettyConfig();
        StorageConfig storageConfig = new StorageConfig();
        Broker broker = new Broker(brokerConfig, nettyConfig, storageConfig);
        broker.start();
        log.info("==== MQServer started.");
        Runtime.getRuntime().addShutdownHook(new Thread(broker::shutdown));
    }
}
